package com.shyfu.services;

import com.shyfu.dao.CommentDAO;
import com.shyfu.entities.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Svitlana on 04-Apr-14.
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentDAO commentDAO;

    @Override
    @Transactional
    public void addComment(Comment comment) {
        commentDAO.addComment(comment);
    }

    @Override
    @Transactional
    public void removeComment(Comment comment) {
        commentDAO.removeComment(comment);
    }

    @Override
    @Transactional
    public void removeComment(long id) {
        commentDAO.removeComment(id);
    }

    @Override
    @Transactional
    public List<Comment> getAllComments() {
        return commentDAO.getAllComments();
    }

    @Override
    @Transactional
    public Comment getComment(long id) {
        return commentDAO.getComment(id);
    }
}
